package com.easyoffer.model.vo;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easyoffer.model.entity.Question;
import com.easyoffer.model.entity.QuestionBank;
import lombok.Data;

import java.io.Serializable;

@Data
public class QuestionBankVO implements Serializable {
    private static final long serialVersionUID = 1231531L;
    /**
     * id
     */
    private Long id;

    /**
     * 标题
     */
    private String title;

    /**
     * 描述
     */
    private String description;

    /**
     * 图片
     */
    private String picture;

    /**
     * 创建用户 id
     */
    private Long userId;

    /**
     * 优先级
     */
    private Integer priority;

    /**
     * 浏览量
     */
    private Integer viewNum;

    /**
     *  题库关联题目
     */
    private Page<QuestionVO> questionPage;

    public static QuestionBankVO objToVo(QuestionBank questionBank) {
        QuestionBankVO questionBankVO = new QuestionBankVO();
        BeanUtil.copyProperties(questionBank, questionBankVO);
        return questionBankVO;
    }

    public static QuestionBank voToObj(QuestionBankVO questionBankVO) {
        QuestionBank questionBank = new QuestionBank();
        BeanUtil.copyProperties(questionBankVO, questionBank);
        return questionBank;
    }
}
